﻿<UserControl xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"  
             x:Class="ConsumptionHistory"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
             xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
             xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
             mc:Ignorable="d"
             x:Name="Me"
             d:DesignHeight="714" d:DesignWidth="725">
  <UserControl.Resources>
    <Style x:Key="GoogleLineDataPointStyle" TargetType="charting:LineDataPoint">
      <Setter Property="Background" Value="#0077CC" />
      <Setter Property="BorderBrush" Value="White"/>
      <Setter Property="BorderThickness" Value="2"/>
      <Setter Property="IsTabStop" Value="False"/>
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="charting:LineDataPoint">
            <!--<Grid
    Background="#aaffffff"
    Margin="0 -20 0 0"
    HorizontalAlignment="Center"
    VerticalAlignment="Top">
              <TextBlock
                                        Text="{TemplateBinding FormattedDependentValue}"
        FontWeight="Bold"
        Margin="2"/>
            </Grid>-->

            <!--<TextBlock Height="25" Width="125" MinWidth="80" MinHeight="25" Text="{Binding Mode=OneWay, Path=AverageConsumption, StringFormat=Total: {0:N2}}" ></TextBlock>-->

            <Grid x:Name="Root" Opacity="1">
              <Ellipse StrokeThickness="{TemplateBinding BorderThickness}"
                     Stroke="{TemplateBinding BorderBrush}"
                     Fill="{TemplateBinding Background}"/>
              <ToolTipService.ToolTip>

                <StackPanel Margin="2,2,2,2">
                  <ContentControl Content="{Binding AverageConsumption}" ContentStringFormat=" {0:N2} KW/h"/>
                  <ContentControl Content="{Binding Comment}" />
                  <ContentControl Content="{Binding Duration}" ContentStringFormat="Dauer {0:###.00} Stunden "/>
                  <ContentControl Content="{Binding Consumption}" ContentStringFormat="Verbrauch {0:###,###,###} "/>
                </StackPanel>
              </ToolTipService.ToolTip>
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  </UserControl.Resources>

  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition/>
    </Grid.RowDefinitions>

    <StackPanel x:Name="test" Grid.Row="0" Orientation="Horizontal">
      <Calendar x:Name="FirstDateLarge" Visibility="Collapsed" SelectedDate="{Binding FirstDate}" />
      <Calendar x:Name="SecondDateLarge" Visibility="Collapsed" SelectedDate="{Binding SecondDate}" />
      <!--<DatePicker SelectedDateFormat="Long" SelectedDate="{Binding FirstDate}"/>
      <DatePicker SelectedDateFormat="Long" SelectedDate="{Binding SecondDate}"/>-->
      <xctk:DateTimePicker x:Name="FirstDateSmall" Value="{Binding FirstDate}"/>
      <xctk:DateTimePicker  x:Name="SecondDateSmall" Value="{Binding SecondDate}"/>
    </StackPanel>
    <xctk:TimelinePanel Visibility="Collapsed" Grid.Row="1"  Orientation="Horizontal"  BeginDate="{Binding FirstDate}" EndDate="{Binding SecondDate}">
      <TextBlock xctk:TimelinePanel.Date="06/06/2012">06/06/2012</TextBlock>
      <TextBlock xctk:TimelinePanel.Date="08/08/2012">08/08/2012</TextBlock>
    </xctk:TimelinePanel>
    <!--<d3:ChartPlotter Name="plotter">
      <d3:Header TextBlock.FontSize="20">
        Very simple chart
      </d3:Header>

      <d3:VerticalAxisTitle>Sine value</d3:VerticalAxisTitle>
      <d3:HorizontalAxisTitle>Sine argument</d3:HorizontalAxisTitle>
      <d3:LineGraph  DataSource="{Binding XValues}" ></d3:LineGraph>
      <d3:LineGraph DataSource="{Binding XValues}" ></d3:LineGraph>
    </d3:ChartPlotter>-->
    <charting:Chart Grid.Row="2" x:Name="Chart1" LegendTitle="Übersicht" >
      <charting:Chart.Axes>
        <charting:LinearAxis Interval="1" Orientation="X"
></charting:LinearAxis>
        <charting:LinearAxis Orientation="Y" Minimum="{Binding Path=YearMinValueByDate}"></charting:LinearAxis>
      </charting:Chart.Axes>
      <!--<charting:LineSeries  IndependentValueBinding="{Binding Path=DayOfYear}" DependentValueBinding="{Binding Path=Consumption}" Title="DayOfYear" />-->
      <charting:LineSeries

            DataPointStyle="{StaticResource GoogleLineDataPointStyle}"
        ItemsSource="{Binding ConsumptionsByDate}" IndependentValueBinding="{Binding Path=DateDC}" DependentValueBinding="{Binding Path=Consumption}" Title="Minutes" >

      </charting:LineSeries>
      <charting:ColumnSeries Visibility="Collapsed" ItemsSource="{Binding ConsumptionsByDate}" IndependentValueBinding="{Binding Path=DateDC}" DependentValueBinding="{Binding Path=Consumption}" Title="Minutes"></charting:ColumnSeries>
    </charting:Chart>
  </Grid>
</UserControl>